package model;

public class Player {
	
	private PlayerType playerType;
	private IA ia;
	private int timeLevel;
	
	/**
	 * 
	 * @param pt
	 * @param brainMode
	 * @param parameter
	 */
	public Player(PlayerType pt, BrainMode brainMode, int parameter) {
		this.ia = new IA(brainMode, parameter);
		setPlayerType(pt);
	}
	
	public IA getIA(){
		return ia;
	}
	
	public PlayerType getPlayerType() {
		return playerType;
	}

	public void setPlayerType(PlayerType playerType) {
		this.playerType = playerType;
	}

	public int getTimeLevel() {
		return timeLevel;
	}

	public void setTimeLevel(int timeLevel) {
		this.timeLevel = timeLevel;
	}


	
	public boolean isHuman() {
		return (playerType == PlayerType.HUMAN);
	}
	public boolean isMachine() {
		return (playerType == PlayerType.MACHINE);
	}
	
	/**
	 * Get machine player action
	 * @throws InterruptedException 
	 */
	public void playAsMachine(Board board) throws InterruptedException {
		ia.setBoard(board);
		ia.startThinking();
	}
	
	public void playAsHuman(Board board, Move move) {
		board.Play(move);
	}
}
